package com.wx.soft.contoller.wx;

import com.wx.util.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by king-pc on 2018/12/7.
 */
@RestController
@RequestMapping("/wxIndex")
public class WxIndexController {

    /**
     * 微信每次请求认证回复
     * @param request
     * @param account
     * @return
     */
    @GetMapping("/{account}/replyMsg")
    public String replyMsg(HttpServletRequest request,@PathVariable String account){
        String signature = request.getParameter("signature");// 微信加密签名
        String timestamp = request.getParameter("timestamp");// 时间戳
        String nonce = request.getParameter("nonce");// 随机数
        String echostr = request.getParameter("echostr");// 随机字符串
        if(true){
            return echostr;
        }
        return R.error();
    }
}
